package de.keychain

import grails.rest.Resource


@Resource(uri='/services', formats=['json'])
class ServiceModel {
	
	String name
	String username

    static constraints = {
		
		name blank:false
		username blank:false
    }
	
	static hasMany = [passwords:Password]
	
	static transients = ["currentPassword"]
	
	String getCurrentPassword(){
		passwords.toList().find({it.enabled}).password
	}
}
